<?php 
    

function data_karyawan($start , $end){

	$header_karyawan = array(
		'Nama'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:21%'), 
		'NIK'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:8%'),  
		'Usia'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:5%'),  
		'Kelamin'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:10%'),   
		'No Seluler'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:12%'),   
		'Status'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:12%'),   
		'Agama'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:10%'),   
		'Catatan'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:22%'),   
	);
	$np=1;
	$row = array();
	$query = "SELECT * FROM karyawan a INNER JOIN biodata b ON a.biodata_id = b.biodata_id
	ORDER BY karyawan_id ASC LIMIT $start , $end";
	$result = my_query($query);
	while ($kar = my_fetch_array($result) ){ 
		$row[] = array( 
			'nama'=>  strtoupper($kar['nama']), 
			'nik'=>  strtoupper($kar['nik']),
			'usia'=>   getage($kar['tanggal_lahir']),
			'kelamin'=>ucfirst($kar['kelamin'])   ,	
			'seluler'=>   strtoupper($kar['telepon_mobile']),  
			'status'=> strtoupper($kar['marital']),  
			'agama'=> strtoupper($kar['agama']),   
			'catatan'=> strtoupper($kar['catatan']),  
		); 
		$np++;
	}
	
	$datas  = table_cetak_rows($row );  
	$view .= table_cetak_builder($header_karyawan , $datas  ,  9 ,false ); 
	return $view;
}
  
?>
<style type="text/css">
<!--

	table.page_header {width: 100%; border: none; background-color: #CDCDCD; border-bottom: solid 1mm #000; padding: 2mm }
	table.page_footer {width: 100%; border: none;  border-top: solid 1mm #000; padding: 2mm}
div.zone
{
	border: solid 2mm #66AACC;
	border-radius: 3mm;
	padding: 1mm;
	background-color: #FFEEEE;
	color: #440000;
}
div.zone_over
{
	width: 30mm;
	height: 35mm;
	overflow: hidden;
}

-->
</style>
<?php 
	$query = "SELECT * FROM karyawan a INNER JOIN biodata b ON a.biodata_id = b.biodata_id ";
	$result = my_query($query);
	$total = my_num_rows($result);
	$limit = 20;
	$total_page = ceil($total/$limit) -1; 
	for($i = 0; $i<=  $total_page  ;$i++):
	$start =  ( $i * $limit );
	
?>	 
<page style="font-size: 10pt">
	<page_footer>
		<table class="page_footer">
			<tr>
				<td style="width: 33%; text-align: left;">
					Laporan daftar karyawan RS. Krakatau Medika
				</td>
				<td style="width: 34%; text-align: center">
					page [[page_cu]]/[[page_nb]]
				</td>
				<td style="width: 33%; text-align: right">
					M A P &copy; 2010 - <?php echo date('Y'); ?>
				</td>
			</tr>
		</table>
	</page_footer>

	<div style="width: 100%; text-align:center; padding:2px; font-size: 13pt ;">Daftar karyawan RS. Krakatau Medika</div>
	<?php echo data_karyawan($start , $limit); ?> 
</page>
<?php endfor; ?>